import React from 'react';
import { menuConfig } from '@/config/menuConfig';
import _ from 'lodash';

const Fallback = ({ pathname }) => {
  function connactMenuConfig(data) {
    return _.flattenDeep(
      _.map(data, (item, key) => {
        if (item.children) {
          return connactMenuConfig(item.children);
        }
        return item;
      })
    );
  }
  const Component = _.filter(
    connactMenuConfig(menuConfig),
    (o) => '/web-b/' + o.path === pathname
  )[0].component;
  return <Component />;
};
export default Fallback;
